package mvp;

public class LoginPresent implements MvpContract.IPresenter {

    MvpContract.IView iView;
    MvpContract.IModule iModule;

    public LoginPresent(MvpContract.IView iView) {
        this.iView = iView;
        iModule = new LoginModule();
    }

    @Override
    public void login(String name, String pwd) {

        iView.Loading();

        iModule.login(name, pwd, new LoginModule.IResult() {
            @Override
            public void result(String ss) {
                iView.DismissLoading();
                if (ss.equals("success")) {

                    iView.loadSuccess(ss);

                } else if (ss.equals("failed")) {

                    iView.loadFailed(ss);
                }
            }
        });


    }
}
